package com.example.demo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 统一拦截
 */

@Configuration
public class AppConfig implements WebMvcConfigurer {
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new LoginInterceptor())//拦截规则
//                .addPathPatterns("/**")//拦截所有请求
//                .excludePathPatterns("/user/login")
//                .excludePathPatterns("/user/reg")
//                .excludePathPatterns("/**/*.html");
//    }

//    @Override
//    public void configurePathMatch(PathMatchConfigurer configurer) {
//        configurer.addPathPrefix("/zhangsan",c->true);
//    }
}
